package com.minelx.sequence.pattern;

import com.minelx.sequence.core.Match;
import com.minelx.sequence.core.ReturnMatcher;
import com.minelx.sequence.core.StringScanner;

public class StringMatcher implements ReturnMatcher<ReturnMatcher<String, StringScanner>, StringScanner> {

	public static final String CAP = "\"";

	@Override
	public boolean isMatch(StringScanner clue) {
		return clue.exists(CAP);
	}

	@Override
	public ReturnMatcher<String, StringScanner> onMatched(StringScanner clue) {
		clue.goes(CAP);
		return Match.content(clue.til('"'));
	}
}
